package com.yx.crawler.runtime;

import java.util.concurrent.LinkedBlockingQueue;

import com.yx.crawler.typedef.CrawlerUrl;

public class BasicCrawlerQueue implements CrawlerQueue {
	private LinkedBlockingQueue<CrawlerUrl> queue = new LinkedBlockingQueue<CrawlerUrl>();
	public BasicCrawlerQueue() {
	}

	@Override
	public void push(CrawlerUrl crawlerUrl)throws Exception {
		queue.put(crawlerUrl);		
	}

	@Override
	public CrawlerUrl pop()throws Exception {
		return queue.take();
	}

	@Override
	public int length() {
		return queue.size();
	}

}
